package com.aaa.sso.controller;

import com.aaa.common.util.Result;
import com.aaa.common.util.ResultStatus;
import com.aaa.sso.service.AuthService;
import io.swagger.annotations.ApiOperation;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("memberlogin")
@ApiOperation("MemberLoginController")
public class MemberLoginController {
    //按名称注入的两种方式
    //    @Autowired
    //    @Qualifier("memberAuthService")
    @Resource(name = "memberAuthService")
    private AuthService authService;

    /**
     * 用户或者会员认证/登录方法
     * @param userName
     * @param password
     * @return
     */
    @GetMapping("auth")
    public Result authMember(String userName,String password){
        return authService.authUserMember(userName,password);
    }

    /**
     * 验证token的方法
     * @param accessToken
     * @return
     */
    @GetMapping("checkToken")
    public boolean checkToken(@RequestParam("accessToken") String accessToken){
        return authService.checkToken(accessToken);
    }
}
